<?php
	namespace app\index\controller;

	use \think\Log;

	use \think\Db;

	use \think\Request;

	class base{

		protected $method='';

		function __construct(){


			$this->method=strtolower($_SERVER['REQUEST_METHOD']);
			// 用于更准确判断提交方式是post还是get
			


			$cont=strtolower(Request::instance()->controller());

			
		}


	 	protected function err($e){
			Log::write($e->getMessage(),'ERR');

			return json_encode(['code'=>0,'msg'=>'服务器繁忙']);
		}

		protected function success($data=[],$msg=''){
			return json_encode(['code'=>1,'msg'=>$msg,'data'=>$data]);
		}

		protected function fail($msg='',$code=0){
			return json_encode(['code'=>$code,'msg'=>$msg]);
		}


	}
	// http://v.juhe.cn/sms/send?mobile=17773553279&tpl_id=214391&tpl_value=%23code%23%3D200203&key=27f0652b5f40b01620fa38c3c8c02511
?>